package bloomberg;

public class MissingAP {

	public static void main(String[] args) {
		int n = Integer.parseInt(args[0]);
		int arr[] = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = Integer.parseInt(args[i + 1]);
		}
		int difference[] = new int[arr.length - 1];
		int missingTerm;

		for (int i = 1; i < arr.length; i++) {
			difference[i - 1] = arr[i] - arr[i - 1];
		}

		for (int j = 0; j < arr.length - 1; j++) {

			if (difference[j] != difference[j + 1]) {
				missingTerm = arr[j] + difference[j + 1];
				System.out.println("The missing term is: " + missingTerm);

				break;

			}
		}
	}

}
